import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import pxToViewport from 'postcss-px-to-viewport-8-plugin';//引入响应式布局的插件

export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(), // 这是 Vite 插件，保留在此处
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  css: {
    postcss: {
      plugins: [
        pxToViewport({
          viewportWidth: 1920,
          viewportHeight: 1000,
          unitPrecision: 5,
          propList: ['*'],
          viewportUnit: 'vw',
          fontViewportUnit: 'vw',
          selectorBlackList: [],
          minPixelValue: 1,
          mediaQuery: true,
          replace: true,
          exclude: [/node_modules/],
          landscape: false,
          landscapeUnit: 'vw',
          landscapeWidth: 568,
        }),
      ],
    },
  },
})
